<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The IteratorIterator class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="infiniteiterator.next.html">« InfiniteIterator::next</a></li>
      <li style="float: right;"><a href="iteratoriterator.construct.html">IteratorIterator::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="spl.iterators.html">迭代器</a></li>
    <li>The IteratorIterator class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.iteratoriterator" class="reference">

 <h1 class="title">The IteratorIterator class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p>


  <div class="section" id="iteratoriterator.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    This iterator wrapper allows the conversion of anything that is
    <a href="class.traversable.html" class="link">Traversable</a> into an Iterator.
    It is important to understand that most classes that do not implement
    Iterators have reasons as most likely they do not allow the full
    Iterator feature set. If so, techniques should be provided to prevent
    misuse, otherwise expect exceptions or fatal errors.
   </p>
  </div>


  <div class="section" id="iteratoriterator.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass">
     
    </div>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">IteratorIterator</strong>
     </span>

     <span class="oointerface"><span class="modifier">implements</span> 
       <a href="class.outeriterator.html" class="interfacename">OuterIterator</a></span> {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="iteratoriterator.construct.html" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><a href="class.traversable.html" class="type Traversable">Traversable</a></span> <code class="parameter">$iterator</code></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">string</span><span class="type"></span></span> <code class="parameter">$class</code><span class="initializer"> = <strong><code>null</code></strong></span></span>)</div>

    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="iteratoriterator.current.html" class="methodname">current</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="iteratoriterator.getinneriterator.html" class="methodname">getInnerIterator</a></span>(): <span class="type"><span class="type">?</span><span class="type"><a href="class.iterator.html" class="type Iterator">Iterator</a></span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="iteratoriterator.key.html" class="methodname">key</a></span>(): <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="iteratoriterator.next.html" class="methodname">next</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="iteratoriterator.rewind.html" class="methodname">rewind</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="iteratoriterator.valid.html" class="methodname">valid</a></span>(): <span class="type">bool</span></div>

   }</div>


  </div>
 
  <div class="section">
   <h2 class="title">注释</h2>
   <blockquote class="note"><p><strong class="note">注意</strong>: 
    <p class="para">
     This class permits access to methods of the inner iterator via the __call magic method.
    </p>
   </p></blockquote>
  </div>
 </div>

 














































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="iteratoriterator.construct.html">IteratorIterator::__construct</a> — Create an iterator from anything that is traversable</li><li><a href="iteratoriterator.current.html">IteratorIterator::current</a> — Get the current value</li><li><a href="iteratoriterator.getinneriterator.html">IteratorIterator::getInnerIterator</a> — Get the inner iterator</li><li><a href="iteratoriterator.key.html">IteratorIterator::key</a> — Get the key of the current element</li><li><a href="iteratoriterator.next.html">IteratorIterator::next</a> — Forward to the next element</li><li><a href="iteratoriterator.rewind.html">IteratorIterator::rewind</a> — Rewind to the first element</li><li><a href="iteratoriterator.valid.html">IteratorIterator::valid</a> — Checks if the iterator is valid</li></ul>
</div>
</div></div></body></html>